package com.xzy.spring.business.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author xzy
 * @date 2021-02-09 11:19
 * 说明：
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class BaseEntity {
    private String identity;
    private long createTime;
    private boolean isDelete;

    /**
     * 创建
     */
    public BaseEntity(String identity) {
        this.identity = identity;
        System.out.println("----> the bean（" + identity + "） has been constructed！");
    }

    /**
     * 初始化
     */
    public void init() {
        System.out.println("----> the bean（" + identity + "） has been initialized！");
        this.createTime = System.currentTimeMillis();
        this.isDelete = false;
    }

    /**
     * 销毁
     */
    public void destroy() {
        System.out.println("----> the bean（" + identity + "） has been destroyed！");
        this.isDelete = true;
    }
}
